/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.support.component;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.text.TextUtils.TruncateAt;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.common.i.s;
import com.qihoo.gamecenter.sdk.support.d.a;

public class PayImgTextView extends LinearLayout {
    protected a a;
    private TextView b;
    private ImageView c;
    private int d;

    public PayImgTextView(Context paramContext) {
        super(paramContext);
        this.a = a.a(paramContext);
        setOrientation(0);
        setGravity(17);
    }

    public void a(int paramInt) {
        removeAllViews();
        this.d = paramInt;
        setOrientation((Math.abs(paramInt) == 65281) ? 1 : 0);
        LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-2, -2);
        this.c = new ImageView(getContext());
        this.c.setLayoutParams(localLayoutParams);
        localLayoutParams = new LinearLayout.LayoutParams(-2, -2);
        localLayoutParams.weight = 1.0F;
        this.b = new TextView(getContext());
        this.b.setGravity(16);
        this.b.setLayoutParams(localLayoutParams);
        if (paramInt >= 0) {
            addView(this.c);
            addView(this.b);
        }
        else {
            addView(this.b);
            addView(this.c);
        }
    }

    public void setImageRes(int paramInt) {
        setImageDrawable(this.a.a(paramInt));
    }

    public void setImageDrawable(Drawable paramDrawable) {
        setImageDrawable(paramDrawable, -2, -2);
    }

    public void setImageDrawable(Drawable paramDrawable, int paramInt1, int paramInt2) {
        if ((this.c != null) && (paramDrawable != null)) {
            this.c.setVisibility(0);
            this.c.setImageDrawable(paramDrawable);
            LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(paramInt1, paramInt2);
            if (this.d == 65282)
                localLayoutParams.rightMargin = s.b(getContext(), 5.0F);
            updateViewLayout(this.c, localLayoutParams);
        }
        else {
            if (this.c == null)
                return;
            this.c.setVisibility(8);
        }
    }

    public void setImgScaleType(ImageView.ScaleType paramScaleType) {
        if (this.c == null)
            return;
        this.c.setScaleType(paramScaleType);
    }

    public void setImageMargin(int paramInt, int[] paramArrayOfInt) {
        if (this.c == null)
            return;
        LinearLayout.LayoutParams localLayoutParams = (LinearLayout.LayoutParams) this.c.getLayoutParams();
        localLayoutParams.rightMargin = paramInt;
        updateViewLayout(this.c, localLayoutParams);
    }

    public void setSingleLine() {
        if (this.b == null)
            return;
        this.b.setSingleLine();
    }

    public void setSingleLine(boolean paramBoolean) {
        if (this.b == null)
            return;
        this.b.setSingleLine(paramBoolean);
    }

    public void setText(CharSequence paramCharSequence) {
        if (this.b == null)
            return;
        this.b.setText(paramCharSequence);
    }

    public void setEllipsize(TextUtils.TruncateAt paramTruncateAt) {
        if (this.b == null)
            return;
        this.b.setEllipsize(paramTruncateAt);
    }

    public void setTextColor(int paramInt) {
        if (this.b == null)
            return;
        this.b.setTextColor(paramInt);
    }

    public void setTextColor(ColorStateList paramColorStateList) {
        if (this.b == null)
            return;
        this.b.setTextColor(paramColorStateList);
    }

    public void setTextSize(float paramFloat) {
        if (this.b == null)
            return;
        this.b.setTextSize(paramFloat);
    }

    public void setTextSize(int paramInt, float paramFloat) {
        if (this.b == null)
            return;
        this.b.setTextSize(paramInt, paramFloat);
    }
}